package com.shigu.mo.vo.responses;

import com.shigu.admin.manager.utils.BeanMapper;

import java.io.Serializable;

/**
 * 公有返回对象
 * Created by Licca on 17/11/15.
 */
public class MoResponse implements Serializable{
    private boolean success;//成功或失败，true为成功
    private String msg;

    public <T extends MoResponse> T  success(){
        return success(null);
    }

    public <T extends MoResponse> T success(String msg){
        T t= (T) this;
        t.setSuccess(true);
        t.setMsg(msg);
        return t;
    }

    public <T extends MoResponse> T error(){
        return error(null);
    }

    public <T extends MoResponse> T error(String msg){
        T t= (T) this;
        t.setSuccess(false);
        t.setMsg(msg);
        return t;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }
}
